response.set('Content-Type', 'text/javascript');

function jsonp(o) {
    var callback = request.query.callback;
    return callback + "(" + JSON.stringify(o) + ")";
}

var mysql = require('mysql');
var connection = mysql.createConnection('mysql://root:123456@10.0.1.200:3306/zclouddb-ac?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true');
 
connection.connect();

connection.query('select region_id,parent_id,region_name,region_type,agency_id,flag from uc_region where region_type=1', function(err, rows, fields) {
    if (err) throw err;
 
    response.end(jsonp({
        rows: rows,
        errcode:0 
    }));
});
 
connection.end();